package com.tao.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.tao.common.validator.annotation.ListValue;
import com.tao.common.validator.group.AddGroup;
import com.tao.common.validator.group.UpdateGroup;
import com.tao.common.validator.group.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author htt
 * @email 2967074103@qq.com
 * @date 2024-02-22 15:32:12
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@NotNull(message = "修改必须指定品牌id", groups = {UpdateGroup.class})
	@Null(message = "新增不能指定id", groups = {AddGroup.class})
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名必须提交, 不能为空或者只有空格", groups = {AddGroup.class}) // 表示不能为null 且不能为只有空格
	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "logo地址必须是合法的url",groups = {AddGroup.class, UpdateGroup.class})
	@NotEmpty(groups = {AddGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ListValue(vals = {0,1}, groups = {AddGroup.class, UpdateStatusGroup.class}, message = "品牌状态必须是0或1, 且不能为空")
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@Pattern(regexp = "^[a-zA-z]$", message = "检索首字母只能是一个字母", groups = {AddGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value = 0, message = "排序必须大于0")
	@NotNull(message = "排序必须指定", groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;

}
